<template>
	<view class="wrap">
		<view class="top"></view>
		<view class="content">
			<view class="title">欢迎登录商户统计</view>
			<input class="u-border-bottom" type="number" v-model="tel" placeholder="请输入手机号" />
			<input class="u-border-bottom" type="password" v-model="password" placeholder="请输入密码" />
			<button @tap="submit" class="getCaptcha">登录</button>
			<view class="alternative">
				<view class="password">忘记密码</view>
				<view class="issue">遇到问题</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			tel: '',
			password:''
		}
	},
	methods: {
		submit() {
			let that = this
			if(this.tel==''){
				this.$u.toast(`手机号不能为空`);
				return
			}
			if(this.password==''){
				this.$u.toast(`密码不能为空`);
				return
			}
			that.tui.request("oauth.login/login", "POST", {phone: this.tel, password: this.password}, false, false, true).then((res) => {
				that.tui.toast(res.info)
				if(res.code==1){
					uni.setStorageSync('d_token', res.data.token)
					setTimeout(function(){
						that.tui.href('/pages/index/index')
					},1000)
				}
			}).catch((res) => {
				
			})
			// uni.$u.http.post('oauth.login/login', {phone: this.tel, password: this.password}).then(res => {
			// 	console.log(res)
			// }).catch(err => {
			//     console.log(err)
			// })
		}
	}
};
</script>

<style lang="scss" scoped>
.wrap {
	font-size: 28rpx;
	.content {
		width: 600rpx;
		margin: 80rpx auto 0;
		.u-border-bottom{margin-bottom: 50rpx;}
		.title {
			text-align: left;
			font-size: 60rpx;
			font-weight: 500;
			margin-bottom: 100rpx;
		}
		input {
			text-align: left;
			margin-bottom: 10rpx;
			padding-bottom: 16rpx;
		}
		.tips {
			color: #eee;
			margin-bottom: 60rpx;
			margin-top: 8rpx;
		}
		.getCaptcha {
			background-color: #1db676;
			color: #fff;
			border: none;
			font-size: 30rpx;
			padding: 12rpx 0;
			margin-top: 100rpx;
			&::after {
				border: none;
			}
		}
		.alternative {
			color: $u-tips-color;
			display: flex;
			justify-content: space-between;
			margin-top: 30rpx;
		}
	}
	.buttom {
		.loginType {
			display: flex;
			padding: 350rpx 150rpx 150rpx 150rpx;
			justify-content:space-between;
			
			.item {
				display: flex;
				flex-direction: column;
				align-items: center;
				color: $u-content-color;
				font-size: 28rpx;
			}
		}
		
		.hint {
			padding: 20rpx 40rpx;
			font-size: 20rpx;
			color: $u-tips-color;
			
			.link {
				color:#f20;
			}
		}
	}
}
</style>
